package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: DK
 * Date: 9/24/13
 * Time: 6:32 PM
 * To change this template use File | Settings | File Templates.
 */
public class Movie {

    private String movie;
    private int year;
    private String director;
    private String rating;

    public Movie(String movie, int year, String director, String rating) {
        this.movie = movie;
        this.year = year;
        this.director = director;

        if(rating.equals("N/A") || ( Integer.parseInt(rating) >= 1 && Integer.parseInt(rating) <= 10))
        {
            this.rating = rating;
        }
        else
        {
            throw new IllegalArgumentException("Rating is in bad format");
        }
    }

    public String display() {
        return this.movie + "\t" + this.year + "\t" + this.director + "\t" + this.rating + "\n";
    }
}
